package com.sx.micowell.module.member

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.miloyu.modelnet.response.PayModeVO
import com.sx.micowell.R

/**
 * @Author: YY
 * @Time: 2021/8/20
 * @Describe TODO
 */
class PaymentListAdapter : BaseQuickAdapter<PayModeVO, BaseViewHolder>(R.layout.item_select_pay_list) {

    var clickId: Int = 0

    override fun convert(holder: BaseViewHolder, item: PayModeVO) {
        holder.setText(R.id.tv_pay_mode, item.name)

        if (item.mode.contains("Alipay")) {
            holder.setImageResource(R.id.image_pay, R.drawable.icon_alipay)
        } else if (item.mode.contains("WeChat")){
            holder.setImageResource(R.id.image_pay, R.drawable.icon_wechat_pay)
        }

        if (clickId == holder.adapterPosition) {
            holder.setBackgroundResource(R.id.image_select, R.drawable.ic_radio_button_checked)
        } else {
            holder.setBackgroundResource(R.id.image_select, R.drawable.ic_radio_button_unchecked)

        }
    }

}